<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
//函数
    // function f1(name,age)
    // {
    //     console.log(name + age)
    //     return 0;
    // }
    // let name = "小明";
    // let age = 15;
    // let ret = f1(name,age);
    // console.log(typeof ret);
//作用域
    // let a =10;//局部
    // a = 100;//全局
//类和对象
    // //1.
    // let Student1 = {
    //     name: "LMX",
    //     sex: "男",
    //     age: 19,
    //     SayHello: function(){
    //         console.log("Say Hello!");
    //     }
    // }
    // console.log(Student1.name);
    // console.log(Student1.sex);
    // console.log(Student1["age"]);
    // Student1.SayHello();
    // console.log(typeof Student1);

    // //2.
    // Student2 = new Object();
    // Student2.name =  "LMX",
    // Student2.sex =  "男",
    // Student2.age = 19,
    // Student2.SayHello = function(){
    //         console.log("Say Hello!");
    //     }
    // console.log(Student2.name);
    // console.log(Student2.sex);
    // console.log(Student2["age"]);
    // Student2.SayHello();
    // console.log(typeof Student2);

    // //3.构造函数：
    // function People(name,height,weight)
    // {
    //     this.name = name;
    //     this.weight = weight;
    //     this.height = height;
    //     this.Say = function()
    //     {
    //         console.log(this.name + "SayHello!");
    //     }
    // }

    // let xiaoming = new People("小明",175,75);
    // console.log(xiaoming);
    // xiaoming.Say();
    // let xiaohong = new People("小红",160,55);
    // console.log(xiaohong);
    // xiaohong.Say();

    //4.类class
    class People
    {
        constructor(name,height,weight)
        {
            this.name = name;
            this.weight = weight;
            this.height = height;
        }
        Say()
        {
            console.log(this.name + "正在说HELLO!");
        }
        static other = "other";
    }
    let xiaoming = new People("小明",175,75);
    console.log(xiaoming);
    xiaoming.Say();
    alert(People.other);

    //5.继承
    class Student extends People
    {
        constructor(name,height,weight,number)
        {
            super(name,height,weight);
            this.number = number;
        }
        Say()
        {
            console.log(this.name + "正在说:嘻嘻!");
        }
    }
    let LMX = new Student("LMX",178,65,39);
    console.log(LMX);
    LMX.Say();
</script>
</html>